package com.yunhe.java.Day09;

/**
 * Created by Administrator on 2017/8/2 0002.
 */
public class Demo {
    public static void count(String str) {
        char[] chars = str.toCharArray();
        int xiaoXie = 0;
        int daXie = 0;
        for(char c : chars) {
            if(c >= (int)'a'  && c <= (int)'z'){
                xiaoXie++;
            }else if(c >= (int)'A'  && c <= (int)'Z') {
                daXie++;
            }
        }
        System.out.println("大写：" + daXie);
        System.out.println("小写：" + xiaoXie);
    }

    public static void firstD(String str){
        str = str.toLowerCase();
        String first = String.valueOf(str.charAt(0));
        str = str.replaceFirst(first,first.toUpperCase());
        System.out.println(str);
    }

    public static void count(String str, String subStr){
        int count = 0;
        int i = str.indexOf(subStr);
        while (i >= 0) {
            count++;
            str = str.substring(i + subStr.length());
            i = str.indexOf(subStr);
        }
        System.out.println(count);
    }

}
